package com.usian.controller;

import com.usian.behavior.ApBehaviorControllerApi;
import com.usian.model.behavior.dto.LikesBehaviorDto;
import com.usian.model.behavior.pojos.ApBehaviorEntry;
import com.usian.model.common.dtos.ResponseResult;
import com.usian.service.ApBehariorEntryService;
import com.usian.service.ApLikeBehaviorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/likes_behavior")
public class ApLikeBehaviorController implements ApBehaviorControllerApi {

    @Autowired
    private ApLikeBehaviorService apLikeBehaviorService;
    @Autowired
    private ApBehariorEntryService apBehariorEntryService;

    @PostMapping("/like")
    @Override
    public ResponseResult like(@RequestBody LikesBehaviorDto dto) {
        return apLikeBehaviorService.like(dto);
    }

    @Override
    @GetMapping("/findByUserId")
    public ApBehaviorEntry findByUserId(@RequestParam Integer userId, @RequestParam Integer equipmentId) {
        return apBehariorEntryService.findEntryId(userId,equipmentId);
    }
}
